package com.example.designpattenexample.template.example;

public abstract class Account {
    private String accountNumber;
    public Account(){}
    public Account(String accountNumber){
        this.accountNumber = accountNumber;
    }

    //根据账号类型查询账户金额
    public double calculateAmount(String accountType,String accountNumber){
       //........
        return 10000;
    }

    public double calculateInterest(){
        String accountType = getAccountType();
        double interestRate = getInterestRate();
        double amount = this.calculateAmount(accountType,accountNumber);
        return  amount * interestRate;
    }

    protected abstract String getAccountType();

    protected abstract double getInterestRate();


}
